package com.yy.job.constant;

import java.util.Map;

import com.google.common.collect.Maps;

/**
 * 常量类
 * 
 * @author eleven.li
 *
 */
public class JobConstant {

	public static final Map<Integer, Integer> FAIL_JOB_DELAY_TIME_CFG = Maps.newHashMap();
	
	// 任务的查询分页条数
	public static final int PAGE_SIZE = 100;
	
	// 任务的查询分页条数/2
	// 调整为75条更合适
	public static final int BREAK_PAGE_SIZE = 75;
	
	// 系统重试次数
	public static final int RETRY_COUNT = 10;
	
	// 最多回溯多少天的pending数据进行重试
	public static final int PENDING_BACK_DAYS = 4;
	
	// 默认延迟策略,单位为分钟
	static {
		FAIL_JOB_DELAY_TIME_CFG.put(Integer.valueOf(0), Integer.valueOf(0));
		FAIL_JOB_DELAY_TIME_CFG.put(Integer.valueOf(1), Integer.valueOf(5));
		FAIL_JOB_DELAY_TIME_CFG.put(Integer.valueOf(2), Integer.valueOf(10));
		FAIL_JOB_DELAY_TIME_CFG.put(Integer.valueOf(3), Integer.valueOf(30));
		FAIL_JOB_DELAY_TIME_CFG.put(Integer.valueOf(4), Integer.valueOf(60));
		FAIL_JOB_DELAY_TIME_CFG.put(Integer.valueOf(5), Integer.valueOf(120));
		FAIL_JOB_DELAY_TIME_CFG.put(Integer.valueOf(6), Integer.valueOf(240));
		FAIL_JOB_DELAY_TIME_CFG.put(Integer.valueOf(7), Integer.valueOf(720));
		FAIL_JOB_DELAY_TIME_CFG.put(Integer.valueOf(8), Integer.valueOf(1440));
		FAIL_JOB_DELAY_TIME_CFG.put(Integer.valueOf(9), Integer.valueOf(1440));
		FAIL_JOB_DELAY_TIME_CFG.put(Integer.valueOf(10), Integer.valueOf(1440));
	}
	
	// 最大重试间隔时间，单位为分钟
	public static Integer MAX_DELAY_MINUTES = 1440*4;
	
	public static final Long NANO_SECONDS = 1000000000L;

	public static final String FORMAT_OPERATOR = "%s(%s)";
	
}
